﻿using Gnivc.CarDealership.Api.Domain.Primitives;

namespace Gnivc.CarDealership.Api.Domain.Entities;

public class Reservation : EntityBase
{
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }

    public Guid VehicleId { get; set; }
    public Guid UserId { get; set; }

    public Vehicle Vehicle { get; set; }
    public User User { get; set; }

    private Reservation()
        : base() { }

    public Reservation(Guid id, Vehicle vehicle, User user)
        : base(id)
    {
        StartDate = DateTime.UtcNow;
        // Обнуляем время
        EndDate = StartDate.Date
            .AddDays(10);

        Vehicle = vehicle;
        VehicleId = vehicle.Id;

        User = user;
        UserId = user.Id;
    }
}
